package Month4;

import java.io.File;

public class a20250424FileTest3
{
    public static void main(String[] args)
    {
        File[] foundMp4;

        File src = new File(":C\\");
        try
        {
            findMp4(src);
        }
        catch(NullPointerException e)
        {
            e.printStackTrace();
        }
        System.out.println(1);
    }
    public static void findMp4(File f)
    {

            File[] files = f.listFiles();//files可能为空
        if(files == null)
        {
            throw new NullPointerException();
        }
            for (File file : files)
            {
                if (file.isFile() && file.getName().endsWith("mp4"))
                {
                    System.out.println(file.getName());
                } else
                {
                    findMp4(file);
                }
            }

    }

}
